Active Directory資産を活用したAWS API認証

Active Directory資産を活用したAWS API認証

Clock Icon2015.09.26

この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

はじめに

藤本です。

Active Directory資産活用シリーズです。 過去に2回、オンプレミスにあるActive Directory資産を活用したManagement Consoleへシングルサインオンする方法をご紹介しました。

第一回 : Active Directory資産を活用したAWS Management ConsoleへのSSO 第二回 : Active Directory資産を活用したAWS Management ConsoleへのSSO(AD Connector編)

AWSを利用する時、Management ConsoleからのGUI操作だけでよいでしょうか?そうですよね。API操作もしたいですよね。

ということで今回はActive Directoryでユーザー認証し、API操作する方法をご紹介します。

概要

AWSにAPIを発行する時の認証方法は大きく以下の2パターンがあります。

  • AccessKeyId + SecretAccessKey
  • AccessKeyId + SecretAccessKey + SecurityToken

前者は永続的なキーとなり、後者は一時的なキーとなります。今回の方法は後者となり、ADFSから発行されたSAML ResponseをSTSに渡すことで、一時的な認証情報(AccessKeyId、SecretAccessKey、SecurityToken)を受け取ることができます。

以下のような流れとなります。

  1. Client -> ADFS (ユーザー認証リクエスト)
  2. ADFS -> AD (ユーザー認証)
  3. AD -> ADFS (認証結果)
  4. ADFS -> Client (SAML Response)
  5. Client -> STS Endpoint (SAML ResponseでAssumeRole)
  6. STS Endpoint -> Client (Temporary Security Credential)
  7. ClientからのAPI発行!!

環境

接続元 : オンプレミス(自宅)

  • AD OS : Windows Server 2012R2 ミドルウェア : Active Directory ドメインサービス、DNSサーバー ADドメイン : fujimoto-home.local 利用するADアカウント : sfujimoto (所属グループ : AWS-developer、メールアドレス : [email protected])

  • ADFS OS : Windows Server 2012R2 ミドルウェア : Active Directory Federation Services

やってみた

設定

ADFS、AWSのSAML認証の設定は過去のエントリをご参照ください。

Active Directory資産を活用したAWS Management ConsoleへのSSO

SAML Response発行

ADFSに対してHTTPリクエストを発行することでSAML Responseを発行することができます。inputタグのValueがSAML ResponseがBase64エンコードされた値となります。AWSにはこのまま引き渡すのでコピーしてください。

# curl -ks -c cookies.txt -d 'Username=@&Password=&AuthMethod=FormsAuthentication' -X POST "https:///adfs/ls/idpinitiatedsignon/?loginToRp=urn:amazon:webservices"
# curl -ks -L -c cookies.txt -b cookies.txt -X GET "https:///adfs/ls/idpinitiatedsignon/?loginToRp=urn:amazon:webservices"

<form action="https://signin.aws.amazon.com:443/saml" method="POST" name="hiddenform"><input name="SAMLResponse" type="hidden" value="PHNhbWxwOlJlc3BvbnNlIElEPSJfNjQ3Y2QzZmUtMjE4OC00MWY3LTgyY2ItYTU3YmFiNmI5NTU5IiBWZXJzaW9uPSIyLjAiIElzc3VlSW5zdGFudD0iMjAxNS0wOS0yNFQxNDoyODowOS43OTlaIiBEZXN0aW5hdGlvbj0iaHR0cHM6Ly9zaWduaW4uYXdzLmFtYXpvbi5jb20vc2FtbCIgQ29uc2VudD0idXJuOm9hc2lzOm5hbWVzOnRjOlNBTUw6Mi4wOmNvbnNlbnQ6dW5zcGVjaWZpZWQiIHhtbG5zOnNhbWxwPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6cHJvdG9jb2wiPjxJc3N1ZXIgeG1sbnM9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMDphc3NlcnRpb24iPmh0dHA6Ly9hZGZzLmZ1amltb3RvLWhvbWUubG9jYWwvYWRmcy9zZXJ2aWNlcy90cnVzdDwvSXNzdWVyPjxzYW1scDpTdGF0dXM+PHNhbWxwOlN0YXR1c0NvZGUgVmFsdWU9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMDpzdGF0dXM6U3VjY2VzcyIgLz48L3NhbWxwOlN0YXR1cz48QXNzZXJ0aW9uIElEPSJfNmJkMjNiMzQtMDcwNy00NjM4LWIxYjYtOGZkMmY4NGQ1NWIzIiBJc3N1ZUluc3RhbnQ9IjIwMTUtMDktMjRUMTQ6Mjg6MDkuNzk5WiIgVmVyc2lvbj0iMi4wIiB4bWxucz0idXJuOm9hc2lzOm5hbWVzOnRjOlNBTUw6Mi4wOmFzc2VydG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c3Npb25JbmRleD0iXzZiZDIzYjM0LTA3MDctNDYzOC1iMWI2LThmZDJmODRkNTViMyI+PEF1dGhuQ29udGV4dD48QXV0aG1Db250ZXh0Q2xhc3NSZWY+dXJuOm9hc2lzOm5hbWVzOnRjOlNBTUw6Mi4wOmFjOmNsYXNzZXM6UGFzc3dvcmRQcm90ZWN0ZWRUcmFuc3BvcnQ8L0F1dGhuQ29udGV4dENsYXNzUmVmPjwvQXV0aG5Db250ZXh0PjwvQXV0aG5TdGF0ZW1lbnQ+PC9Bc3NlcnRpb24+PC9zYW1scDpSZXNwb25zZT4=" /><noscript>

スクリプトが無効です。続けるには、[送信] をクリックしてください。

<input type="submit" value="Submit" /></noscript>

</form><script language="javascript">window.setTimeout('document.forms[0].submit()', 0);</script>

もちろんbase64ですのでデコードすることが可能です。

# echo "PHNhbWxwOlJlc3BvbnNlIElEPSJfNjQ3Y2QzZmUtMjE4OC00MWY3LTgyY2ItYTU3YmFiNmI5NTU5IiBWZXJzaW9uPSIyLjAiIElzc3VlSW5zdGFudD0iMjAxNS0wOS0yNFQxNDoyODowOS43OTlaIiBEZXN0aW5hdGlvbj0iaHR0cHM6Ly9zaWduaW4uYXdzLmFtYXpvbi5jb20vc2FtbCIgQ29uc2VudD0idXJuOm9hc2lzOm5hbWVzOnRjOlNBTUw6Mi4wOmNvbnNlbnQ6dW5zcGVjaWZpZWQiIHhtbG5zOnNhbWxwPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6cHJvdG9jb2wiPjxJc3N1ZXIgeG1sbnM9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMDphc3NlcnRpb24iPmh0dHA6Ly9hZGZzLmZ1amltb3RvLWhvbWUubG9jYWwvYWRmcy9zZXJ2aWNlcy90cnVzdDwvSXNzdWVyPjxzYW1scDpTdGF0dXM+PHNhbWxwOlN0YXR1c0NvZGUgVmFsdWU9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMDpzdGF0dXM6U3V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Z25pbmcgLSBhZGZzLmZ1amltb3RvLWhvbWUubG9jYWwwHhcNMTUwODE5MTUxMjM1WhcNMTYwODE4MTUxMjM1WjAyMTAwLgYDVQQDEydBREZTIFNpZ25pbmcgLSBhZGZzLmZ1amltb3RvLWhvbWUubG9jYWwwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCxJoAv3zKf3erfpzbuBsnmlj223OxHhECVLf4+dOX/YISmm0MMDqmXE51MfmSC29icwgk8HR1d4JHVGfM3OY+EhpFEmS+2dYop42ApGlygcVl5FsQTJYoYbh6uvD2g03WRAGEm/pHtsAbh09pn+/gJqyeVeCMG4hchw+7wYDvMmf99+dIOmQepun15SSWuZaba9yZtP78fjhgpRC4DIUQqBjgT9Ln6n3f4nZT13EqGppV3hwGdzgocMVVjNIWdVFkh1JB3JXJLKz0RYlpyTL3p6UCdscugCju69TG/sGxuJplVuj1t+oz0rinXGM8cYuhSuY/xGLwFf9w3Bq1hQx17AaMBAAEwDQYJKoZIhvcNAQELBQADggEBACAcx3BZmAmCpEwojUbMmvN5rdOwV0HPIxP1UujgP46LWkl/7AmUgiAi+LTesfTq7Q5bOJdpJzbC2uszRCg81bGBZJfRIOffu6jfuXJ/OP4bYlsPyTuzO4wNxaqiLMqQFIV8cbYuBUHENWLUHfLGAuj0w1y3cTuGsCqV6MEtY+2iTZCOEFMrw4WnUFSOH2yHjM8WWdHrpXP3+qYY4mOHiKy0RsAFKzURRP1VOEDJEXy2pOqZFzAp1Px8dhEMnwUg3TLI9UPndxfVs3AfxJYIzcq02fV4GNLA9Po/a6esrNCo2kMbPeArUWgV5F/h9IVcU5xsiLZEgHJOqQfuolgeykc=FUJIMOTO-HOME\sfujimotourn:amazon:[email protected]:aws:iam::000000000000:saml-provider/fujimoto-home, arn:aws:iam::000000000000:role/ADFS-developerurn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport

このようにSAML ResponseはAssertion IDやClaim Ruleの結果が含まれます。

一時的な認証情報発行

AWS STS APIのAssumeRoleWithSamlを利用して、一時的な認証情報を発行します。 オプションにRoleARN、SAMLProviderARN、SAML Responseを与えます。

# aws sts assume-role-with-saml --role-arn arn:aws:iam::000000000000:role/ADFS-developer --principal-arn arn:aws:iam::000000000000:saml-provider/fujimoto-home --saml-assertion "PHNhbWxwOlJlc3BvbnNlIElEPSJfNjQ3Y2QzZmUtMjE4OC00MWY3LTgyY2ItYTU3YmFiNmI5NTU5IiBWZXJzaW9uPSIyLjAiIElzc3VlSW5zdGFudD0iMjAxNS0wOS0yNFQxNDoyODowOS43OTlaIiBEZXN0aW5hdGlvbj0iaHR0cHM6Ly9zaWduaW4uYXdzLmFtYXpvbi5jb20vc2FtbCIgQ29uc2VudD0idXJuOm9hc2lzOm5hbWVzOnRjOlNBTUw6Mi4wOmNvbnNlbnQ6dW5zcGVjaWZpZWQiIHhtbG5zOnNhbWxwPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6cHJvdG9jb2wiPjxJc3N1ZXIgeG1sbnM9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMDphc3NlcnRpb24iPmh0dHA6Ly9hZGZzLmZ1amltb3RvLWhvbWUubG9jYWwvYWRmcy9zZXJ2aWNlcy90cnVzdDwvSXNzdWVyPjxzYW1scDpTdGF0dXM+PHNhbWxwOlN0YXR1c0NvZGUgVmFsdWU9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMDpzdGF0dXM6U3VjY2VzcyIgLz48L3NhbWxwOlN0YXR1cz48QXNzZXJ0aW9uIElEPSJfNmJkMjNiMzQtMDcwNy00NjM4LWIxYjYtOGZkMmY4NGQ1NWIzIiBJc3N1ZUluc3RhbnQ9IjIwMTUtMDktMjRUMTQ6Mjg6MDkuNzk5WiIgVmVyc2lvbj0iMi4wIiB4bWxucz0idXJuOm9hc2lzOm5hbWVzOnRjOlNBTUw6Mi4wOmFzc2VydGlvbiI+PElzc3Vlcj5odHRwOi8vYWRmcy5mdWppbW90by1ob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I2LThmZDJmODRkNTViMyI+PEF1dGhuQ29udGV4dD48QXV0aG1Db250ZXh0Q2xhc3NSZWY+dXJuOm9hc2lzOm5hbWVzOnRjOlNBTUw6Mi4wOmFjOmNsYXNzZXM6UGFzc3dvcmRQcm90ZWN0ZWRUcmFuc3BvcnQ8L0F1dGhuQ29udGV4dENsYXNzUmVmPjwvQXV0aG5Db250ZXh0PjwvQXV0aG5TdGF0ZW1lbnQ+PC9Bc3NlcnRpb24+PC9zYW1scDpSZXNwb25zZT4="
{
"Audience": "https://signin.aws.amazon.com/saml",
"NameQualifier": "j8KnghRbguhf/c+FfoMsluk8ke0=",
"AssumedRoleUser": {
"Arn": "arn:aws:sts::00000000:assumed-role/ADFS-developer/[email protected]",
"AssumedRoleId": "AROAJ55S34ROZ6QCWKYFS:[email protected]"
},
"Subject": "FUJIMOTO-HOME\\sfujimoto",
"Credentials": {
"Expiration": "2015-09-24T15:44:35Z",
"SessionToken": "AQoDYXdzEBgagAMBsEgf5oDM+LG4prWyRUk/FNRcoWo8paEaz1wLjRZs8NALJ/6RiVUPZQW1jkhJsDe2e1cY8GsNfE645bA5dCOtW9RXGub6+2uf51w9huaO3kZXx49sH9BBuPUdGAV34dfwM7TTL4e6bJLK5Oyva6I1314xGUeEVSoPV08L977N/ft0GEnJXURAkkNhPyuY6l4L3nxv5Mi/QlLtxwNvAyzjdcbxJyO09tkAG1tl38Wtn9wrQaSU5PojxHu415tteesanrITE3IfBVO734N9CfNJ7YgQ7J7IQQ5yUX2BP31QCsqe7YWFwQ2lMMXjQIIWjgQ/0QfEwB9rxrZcP6EJrzlxq0OyDDzySPabeaz6ZjydHTPec1WsSIi/Hg1wxY5NPjqLKUXYbAegIIMI0twsHNx2GKqhu+AgOqZA24nme8iRaS/RcODKNIgs9wMyKkmtegvYQYzuQ04tVYBx1O1OlztGmrKs+x+zsgQLj6gVWLkYHPj37h/FVsPvZcB5WBDLx/wg05iQsAU=",
"AccessKeyId": "ASIAJI2V66WANRTD5BFQ",
"SecretAccessKey": "/VbW13iSqWgfQowWHffGAKrt7a17oT9hUVi24cyd"
},
"SubjectType": "persistent",
"Issuer": "http:///adfs/services/trust"
}

AccessKeyId、SecretAccessKey、SessionTokenがレスポンスに含まれています。これらをCredentialに利用して、AWS APIを発行してみましょう。S3のバケットを取得してみます。

# export AWS_ACCESS_KEY_ID=ASIAJI2V66WANRTD5BFQ
# export AWS_SECRET_ACCESS_KEY=/VbW13iSqWgfQowWHffGAKrt7a17oT9hUVi24cyd
# export AWS_SESSION_TOKEN=AQoDYXdzEBgagAMBsEgf5oDM+LG4prWyRUk/FNRcoWo8paEaz1wLjRZs8NALJ/6RiVUPZQW1jkhJsDe2e1cY8GsNfE645bA5dCOtW9RXGub6+2uf51w9huaO3kZXx49sH9BBuPUdGAV34dfwM7TTL4e6bJLK5Oyva6I1314xGUeEVSoPV08L977N/ft0GEnJXURAkkNhPyuY6l4L3nxv5Mi/QlLtxwNvAyzjdcbxJyO09tkAG1tl38Wtn9wrQaSU5PojxHu415tteesanrITE3IfBVO734N9CfNJ7YgQ7J7IQQ5yUX2BP31QCsqe7YWFwQ2lMMXjQIIWjgQ/0QfEwB9rxrZcP6EJrzlxq0OyDDzySPabeaz6ZjydHTPec1WsSIi/Hg1wxY5NPjqLKUXYbAegIIMI0twsHNx2GKqhu+AgOqZA24nme8iRaS/RcODKNIgs9wMyKkmtegvYQYzuQ04tVYBx1O1OlztGmrKs+x+zsgQLj6gVWLkYHPj37h/FVsPvZcB5WBDLx/wg05iQsAU=
# export AWS_DEFAULT_REGION="ap-northeast-1"
# aws s3 ls
2015-08-28 16:45:51 cf-templates-1powceaee2ee2-ap-northeast-1

バケット情報を取得できました。一時的な認証情報の取得に成功しています。

スクリプト化

これらの認証を実施するpythonスクリプトをgistに公開しました。

実行すると以下のようになります。

# ./assume_role_for_adfs.py --adfs-fqdn adfs.fujimoto-home.local --username [email protected]
[email protected]'s Password:
Execute following commands to set AWS credentials
-----
export AWS_ACCESS_KEY_ID=ASIAI6FEUDEHPV325XJA
export AWS_SECRET_ACCESS_KEY=FVxf8XqxnRb8snorPxu0lqQxSofjyJCOfDSw4g8P
export AWS_SESSION_TOKEN=AQoDYXdzEEEa8AIsPa6X9Uf6mOJ7X6BDeSF7CJWITEJkyo3qcTfGPUoIbSsmXwMpnsfDLCvj+O87T9D1og8hsoTXF7eR9VJDTG2BPnvN1cn0Zop/1RBuVF77QaaSituzTPBlamQpAmm72mzb0oX7MMw/fWu9B4haCkWkUJHID7vVK/8s7YbRPAu/y8P0zod4UGuSoKA4ko8DdrjS89sB89gTwr1YdotzqdeSj5yI4Nshg+JDHebI/V8M+EPsDARQs5Axl+uTGoGLl8cMiN7WGXX8Ng7p2F8bHWYnWCcOJjfkKHDvuOJT0vL5vCF9aHwgGqAnThzHFEst83CpqHyyPQzoAkBd6zuGlNbObV0O9NWrNbq6+eFBN/y36SpWN9TKjZGc63XoPjmVqmjopMLjGcri1jDWoyHtWorrFMHJbe7Q9UKK/AbMDp0PQCbZNoHcFImBSZU8yUptsWJx0LM1Mge3hU69wy+D5sh+2D9nk4bGgKv1UEf2syXpKyCCl5mwBQ==

まとめ

いかがでしたでしょうか? Active Directoryを活用したManagement ConsoleへのSSO、一時的なAPI認証情報の取得をご紹介しました。既存の環境にActive Directoryがある組織はAWS上でIAM Roleさえ作成してしまえば、IAMユーザーを作らずともアカウント管理をActive Directoryに委任することができます。

参考情報

How to Implement Federated API and CLI Access Using SAML 2.0 and AD FS SAML wrapper for aws cli

Share this article

facebook logohatena logotwitter logo

© Classmethod, Inc. All rights reserved.